import { combineReducers } from 'redux';
import { fork, all } from 'redux-saga/effects';
import { WaitRepayment, waitRepaymentState, waitRepaymentSaga } from './WaitRepayment';
import { OverdueList, overEndListState, overEndListSaga } from './EndRecordList';
import { OverdueOrderDistribute, orderEndDistributeState, orderEndDistributeSaga } from './EndRecordDistribute';
import { OrderDetail, orderDetailState, orderDetailSaga } from './OrderDetail';
import { PhoneUrgeList, phoneEndListState, phoneEndListSaga } from './EndRecordphoneUrgeList';


const endRecordRoutes = [
    { path: '/waitRepayment', component: WaitRepayment },
    { path: '/endRecordList', component: OverdueList, exact: true },
    { path: '/endRecordList/:id', component: OrderDetail },
    { path: '/endRecordDistribute', component: OverdueOrderDistribute },
    { path: '/endRecordphoneUrgeList', component: PhoneUrgeList, exact: true },
    { path: '/endRecordphoneUrgeList/:id', component: OrderDetail }
];

const orderEndManageMenuList = [
    {
        title: '到期订单管理',
        key: '/endRecord',
        icon: 'book',
        children: [
            {
                title: '到期订单分配',
                key: '/endRecordDistribute',
                icon: 'file-add'
            },
            {
                title: '到期订单档案',
                key: '/endRecordList',
                icon: 'inbox'
            },
            {
                title: '到期单电话列表',
                key: '/endRecordphoneUrgeList',
                icon: 'phone'
            }
        ]
    }
];
const oderEndManageState = combineReducers({
    waitRepaymentState,
    orderEndDistributeState,
    overEndListState,
    orderDetailState,
    phoneEndListState
});

function* oderEndManageSaga() {
    yield all([
        fork(waitRepaymentSaga),
        fork(orderEndDistributeSaga),
        fork(overEndListSaga),
        fork(phoneEndListSaga),
        fork(orderDetailSaga)
    ])
}
export { endRecordRoutes, orderEndManageMenuList, oderEndManageState, oderEndManageSaga };